<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
</head>
<body>

<div id="app">
    <span v-bind:title="message">
        鼠标悬停几秒查看此处动态绑定的提示信息
    </span>
    <!--    条件判断-->
    <h1 v-if="ok">Yes</h1>
    <h1 v-else>No</h1>
    <h1 v-if="type==='A'">A</h1>
    <h1 v-else-if="type==='B'">B</h1>
    <h1 v-else-if="type==='D'">D</h1>
    <h1 v-else>C</h1>
    <!--    循环-->
    <li v-for="(item,index) in items">
        {{item.message}}-{{index}}
    </li>
    <!--    事件-->
    <button v-on:click="sayHi">check Me</button>
    <!--    {{message}}-->
    <br>
    <!--    双向绑定-->
    <input type="text" v-model="msgInput">{{msgInput}}
    <br>
    <input type="radio" v-model="sexValue" name="sxe" value="男">
    <input type="radio" v-model="sexValue" name="sex" value="女">
    选中了谁: {{sexValue}}
    <br>
    <select v-model="selected">
        <option value="" disabled>--请选择--</option>
        <option>A</option>
        <option>B</option>
        <option>C</option>
    </select>
    选中了谁: {{selected}}

</div>


</body>
<script>
    var vm = new Vue({
        el: "#app",
        data: {
            message: "Hello Vue!",
            ok: true,
            type: "B",
            items: [
                {message: "cai说Java"},
                {message: "cai说前端"}
            ],
            msgInput: "请输入:",
            sexValue: "",
            selected: ""
        },
        methods: {
            sayHi: function () {
                alert(this.message);
            }
        }
    })
</script>
</html>